package com.hzky.demo.dao;

import com.hzky.demo.model.Course;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created by admin on 2017/6/6.
 */
public interface CourseDao extends JpaRepository<Course, Integer> {
    @Query(value="select top 10 a.* from child_english.dbo.course a where a.t_phone=:id",nativeQuery = true)
    List<Course> getCoursesWithTeacherId(@Param("id") String id);


    @Query(value = "select top 10 a.* from child_english.dbo.course a,child_english.dbo.teacher b where b.school_id=:id and a.t_phone=b.phone_number",nativeQuery = true)
    List<Course> getCourseWithSchoolId(@Param("id")Integer id);
}
